function simulate_all
    e1
end

function e1
    p=10
    sparsity=0.7
    X=randi([-10 10], p,p); X=(X+X')/2;
    for i=1:p
        for j=i+1:p
            if rand < sparsity
                X(i,j) = 0;
                X(j,i) = 0;
            end
        end
    end
    
    while (1) 
        e = eig(X)
        if min(e) > 1, break; end
        a = 1./(e-min(e)+1);
        for i=1:p, X(i,i)=X(i,i)+a(i); end
        min(e)
    end
    
    X
    eig(X)
end